CC=gcc
LIBS=`pkg-config glib-2.0 --libs`
FLAGS=`pkg-config glib-2.0 --cflags`
OBJECTS=misc_tools.o load_save.o view.o model.o avions.o
TOPLEVEL_INCLUDES=model.h model_structs.h
COMP_OPTS=compile_opts.h

all: main.bin

main.bin : main.c $(OBJECTS) $(TOPLEVEL_INCLUDES)
	$(CC) main.c $(OBJECTS) -o main.bin $(FLAGS) $(LIBS)

model.o : model.c $(TOPLEVEL_INCLUDES)
	$(CC) -c model.c $(FLAGS)

misc_tools.o : misc_tools.c misc_tools.h $(COMP_OPTS)
	$(CC) -c misc_tools.c $(FLAGS)

load_save.o : load_save.c load_save.h model_structs.h
	$(CC) -c load_save.c $(FLAGS)

view.o : view.c view.h $(COMP_OPTS)
	$(CC) -c view.c $(FLAGS)

avions.o : avions.c avions.h model_structs.h
	$(CC) -c avions.c $(FLAGS)
clean:
	rm *.o *.bin
